package com.fowo.api.sys.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fowo.api.common.annotaion.Sensitive;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;

@Data
@Schema(title = "系统任务数据源")
@TableName("sys_task_data_source")
public class SysTaskDataSource {

    @Schema(title = "编号")
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(title = "名称")
    @NotEmpty(message = "名称不能为空")
    @Length(max = 50, message = "名称最大 50 个字符")
    private String name;

    @Schema(title = "驱动")
    @NotEmpty(message = "驱动不能为空")
    @Length(max = 50, message = "驱动最大 50 个字符")
    private String driver;

    @Schema(title = "用户名")
    @NotEmpty(message = "用户名不能为空")
    @Length(max = 50, message = "用户名最大 50 个字符")
    private String username;

    @Schema(title = "密码")
    @NotEmpty(message = "密码不能为空")
    @Length(max = 50, message = "密码最大 50 个字符")
    @Sensitive
    private String password;

    @Schema(title = "地址")
    @NotEmpty(message = "地址不能为空")
    @Length(max = 512, message = "地址最大 512 个字符")
    private String url;

    @TableLogic
    private Boolean delFlag;
}
